<script src="__LAYUI__/layui.js"></script>
<link href="__LAYUI__/css/layui.css" rel="stylesheet"/>

<form class="layui-form layui-form-pane" action="/index/input/addMonograph">

    <div class="layui-form-item" pane>
        <label class="layui-form-label">书名</label>
        <div class="layui-input-block">
            <input type="text" name="book_name" value="{$book_name}" placeholder="请输入书名" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item" pane>
        <label class="layui-form-label">出版社</label>
        <div class="layui-input-block">
            <input type="text" name="book_company" value="{$book_company}" placeholder="请输入出版社名称" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item" pane>
        <label class="layui-form-label">著作人</label>
        <div class="layui-input-block">
            <input type="text" name="book_author" value="{$book_author}" placeholder="请输入著作人名称" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item" pane>
        <label class="layui-form-label">作者简介</label>
        <div class="layui-input-block">
            <textarea name="author_about" required lay-verify="required" value="{$author_about}" placeholder="请输入作者简介" class="layui-textarea">{$author_about}</textarea>
        </div>
    </div>
    <div class="layui-form-item" pane>
        <label class="layui-form-label">字数</label>
        <div class="layui-input-block">
            <input type="text" name="book_word_count" value="{$book_word_count}" placeholder="请输入著作字数" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" pane>
        <label class="layui-form-label" style="width:116px;">计划出版时间</label>
        <div class="layui-input-inline">
            <input class="layui-input" id="date" value="{$book_date}" placeholder="yyyy-MM" type="text" name="book_date">
        </div>
    </div>

    <div class="layui-form-item" pane>
        <label class="layui-form-label" style="width:116px;">书号状态</label>
        <div class="layui-input-inline">
            <select name="status" lay-verify="">
                <option value="{$status}" disabled>{$status}</option>
                <option value="待申请">待申请</option>
                <option value="申报中">申报中</option>
                <option value="已下">已下</option>
            </select>
        </div>
    </div>


    <div class="layui-form-item" pane>
        <label class="layui-form-label">内容简介</label>
        <div class="layui-input-block">
            <textarea name="book_about" required lay-verify="required" value="{$book_about}" placeholder="请输入内容简介" class="layui-textarea">{$book_about}</textarea>
        </div>
    </div>
    <input type="hidden" name="id" value="{$id}">
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="demo1">修改</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>

</form>
<script>
    layui.use(['form','laydate','jquery'], function(){
        var laydat = layui.laydate
            ,$ = layui.$
            ,form = layui.form;
        laydat.render({
            elem: '#date'
            ,type: 'month'
        });
        form.on('submit(demo1)', function(data){
            $.post('/index/monograph/editMonograph',data.field,function (res) {
                layer.msg(res.msg, {
                    icon: 1,
                    time: 3000 //2秒关闭（如果不配置，默认是3秒）
                });
                if(res.code){
                    parent.location.reload();
                }
            })

            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });

    });

</script>